* Add initial "Type Hierarchy" node to the elisp manual
authorAndrea Corallo <acorallo@gnu.org>
Thu, 15 Feb 2024 15:10:59 +0000 (16:10 +0100)
committerAndrea Corallo <acorallo@gnu.org>
Thu, 15 Feb 2024 15:48:36 +0000 (16:48 +0100)
* doc/lispref/objects.texi (Lisp Data Types, Type Hierarchy): Add
Type Hierarchy node.

doc/lispref/objects.texi

index b8fd5ed4345384af2a47f4c5dfdb2ed9e4b651eb..18484bac36809a039cd97b7e255fee7092a62a33 100644 (file)
@@ -60,6 +60,7 @@ to use these types can be found in later chapters.
 * Type Predicates::             Tests related to types.
 * Equality Predicates::         Tests of equality between any two objects.
 * Mutability::                  Some objects should not be modified.
+* Type Hierarchy::              Type Hierarchy.
 @end menu
 
 @node Printed Representation
@@ -2493,3 +2494,23 @@ their components.  For example, @code{(eq "abc" "abc")} returns
 literal @code{"abc"}, and returns @code{nil} if it creates two
 instances.  Lisp programs should be written so that they work
 regardless of whether this optimization is in use.
+
+@node Type Hierarchy
+
+Lisp types are organized in a hierarchy, this means that types can
+derive from other types.  Objects of a type A (which derives from type
+B) inherite all the charateristics of type B.  This also means that
+every objects of type A is at the same time of type B.
+
+Every type derives from type @code{t}.
+
+New types can be defined by the user through @code{defclass} or
+@code{cl-defstruct}.
+
+The Lisp Type Hierarchy for primitive types can be represented as
+follow:
+
+@image{type_hierarchy,,,,png}
+
+For example type @code{list} derives from (is a special kind of) type
+@code{sequence} wich on itself derives from @code{t}.